<div class="main mt10" >
    <!-- Star of area2s -->
    <div class="area2s">
    	<!-- Star of Col1 -->
    	<div class="col1">
			<div class="breadCrumb">
				<div class="fl"><span class="cRed fb">当前位置：</span>&nbsp;<?php echo CHtml::link('首页', array('/')); ?>&nbsp;›&nbsp;<strong>在线问吧</strong></div>
			</div> 
			<div class="qasContent mt10">
				<div class="msg">欢迎使用广州心理咨询网在线问吧! 专业的心理咨询师团队为您服务! <br />收到您的提问后，我们会安排适合的咨询师，在一到三天内对您的问题作出回复。</div>
				<?php if(isPost() && ! count($errors) > 0) : ?>
				<div class="notice_oktext" style="margin-top: 10px;">提问成功发表，请随时关注咨询师对您的回复。</div>
				<?php endif ?>
				<ul class="qasTabs">
					<li><?php echo CHtml::link('<span>最新提问</span>', array('/qas'), array('class' => $filter == 'all' ? 'active' : '')); ?></li>
					<li><?php echo CHtml::link('<span>已解决</span>', array('/qas/list/status/'.QAs::STATUS_SOLVED), array('class' => $filter == 'solved' ? 'active' : '')); ?></li>
					<li><?php echo CHtml::link('<span>未解决</span>', array('/qas/list/status/'.QAs::STATUS_UNSOLVED), array('class' => $filter == 'unsolved' ? 'active' : '')); ?></li>
				</ul>
				<div class="cb"></div>
				<ul class="qasLists fl" id="qasLists">
					<li>
                    	<ul class="qasLists-items" id="qasLists-items">
                    		<?php $count = count($qAs); ?>
                    		<?php foreach($qAs as $k => $_qA) : ?>
                    		<?php $lastReply = $_qA->getLastReply(); ?>
                        	<li class="item<?php if($k%2 === 1) : ?> alt<?php endif; ?>"<?php if($count == $k+1) : ?> id="styleNone1"<?php endif; ?>>
                                <table cellpadding="0" cellspacing="0" border="0" width="100%" class="t1">
                                    <tbody>
                                        <tr class="cHui1">
                                            <td class=""><span class="author">由&thinsp;<a href="<?php echo CHtml::normalizeUrl(array('/users/viewprofile', 'id' => $_qA->author->uid)) ?>"><?php echo $_qA->author->userName(); ?></a>&thinsp;</span><span class="dateline">发表于<?php echo fromNow($_qA->qaDate); ?></span></td>
                                            <td class="lastPost tr"><?php if($lastReply !== null && $lastReply->author->getIsAdmin()) : ?>咨询师 <a href="<?php echo CHtml::normalizeUrl(array('/users/viewprofile', 'id' => $lastReply->author->uid)) ?>"><?php echo $lastReply->author->username ?></a> 回复于<span class="data"><?php echo fromNow($lastReply->qaDate); ?></span><?php else : ?>等待回复<?php endif ?></td>
                                        </tr>
                                        <tr>
                                            <td class="title"><a href="<?php echo CHtml::normalizeUrl(array('/qas/view', 'id' => $_qA->qaId)); ?>"><?php $this->beginWidget('CHtmlPurifier'); ?><?php echo $_qA->qaTitle; ?><?php $this->endWidget('CHtmlPurifier'); ?></a><span class="status<?php if($_qA->qaStatus == QAs::STATUS_UNSOLVED) : ?> cOrg<?php elseif($_qA->qaStatus == QAs::STATUS_SOLVED): ?> cGre<?php endif; ?>">[<?php echo $_qA->getStatusText(); ?>]</span></td>
                                            <td class="tr"><?php if( ! empty($_qA->replied)) : echo fromNow($_qA->replied); endif; ?></td>
                                        </tr>
                                        <tr>
                                            <td class="content" colspan="2"><?php $this->beginWidget('CHtmlPurifier'); ?><?php echo truncStr($_qA->qaContent, 360, '...'); ?><?php $this->endWidget('CHtmlPurifier'); ?></td>
                                        	
                                        </tr>
                                    </tbody>
								</table>
                            </li>
                            <?php endforeach; ?>
                        </ul>     
					</li>
				</ul>
				<div class="cb"></div>
				<div class="mt10"></div>
				<?php $this->widget('CLinkPager', array('pages' => $pages)); ?>
                <div class="cb"></div>
				<div class="post mt10">
                	<div class="postInner" id="postQA">
                        <h3>我要提问</h3>
					<?php if( ! Users::isLogin()) : ?><div class="state mt10">您尚未登录，需要<?php echo CHtml::link('登录', array('/users/signin', 'rf' => urlencode(Yii::app()->request->pathInfo)), array('class' => 'cRed')); ?>才能在问吧咨询提问。还不是会员？点击<?php echo CHtml::link('这里', array('/users/signup'), array('class' => 'cRed')); ?>注册。</div>
					<?php else : ?><div class="mt10">您好，<span class="cRed"><?php echo Yii::app()->user->name; ?></span>，需要提问吗？</div><?php endif; ?>

                        <div class="postBody mt20">
                        <?php echo CHtml::form('', 'POST'); ?>
                            <table border="0" cellpadding="0" cellspacing="0">
                                <tbody>
                                    <tr>
                                        <td class="tr">咨询标题：</td>
                                        <td><?php echo CHtml::activeTextField($qA, 'qaTitle', array('class' => 'ipt3', 'size' => '35')); ?> &nbsp;请简要描述一下您的问题 </td>
                                    </tr>
                                    <tr>
                                        <td class="tr" valign="top">咨询内容：</td>
                                        <td><?php echo CHtml::activeTextArea($qA, 'qaContent', array('class' => 'ipt3', 'style' => 'width: 400px; height: 90px;')); ?> &nbsp;<p class="mt8">请尽量详细描述您的咨询问题包括您相关的个人经历，将有助咨询师更好地帮助您</p></td>
                                    </tr>
                                    <tr>
                                        <td class="tr" valign="top">验证码：</td>
                                    	<td><?php echo CHtml::activeTextField($qA, 'verifyCode', array('size' => '15', 'class' => 'ipt3')); ?>&nbsp;&nbsp;&nbsp;&nbsp;<?php $this->widget('CCaptcha', array('captchaAction' => 'captcha', 'buttonLabel' => '看不清？换张图', 'buttonOptions' => array('class' => 'cOrg', 'height' => '25px', 'style' => "margin-left :5px;vertical-align:super;")))?></td>
                                    </tr>
                                    <tr>
                                    <td></td>
                                        <td>
								
                               <?php if(isset($errors['qaTitle']) || isset($errors['qaContent']) || isset($errors['verifyCode'])) : ?>
                        <div class="notice_error"><?php echo isset($errors['qaTitle'][0]) ? $errors['qaTitle'][0] : ''; ?><?php echo isset($errors['qaContent'][0]) ? $errors['qaContent'][0] : ''; ?><?php echo isset($errors['verifyCode']) ? $errors['verifyCode'][0] : '' ?></div>
                       <?php endif; ?>
                       					</td>
                                    </tr>
                                    <tr>
                                        <td>&nbsp;</td>
                                        <td><?php echo CHtml::submitButton('提交', array('class' => 'btn1')); ?></td>
                                    </tr>	
                                   							
                                </tbody>
                            </table>
                            <?php echo CHtml::endForm(); ?>
                        </div>
                    </div>
                </div>
			</div>
        </div>
        <!-- End of Col1 -->
        <!-- Star of Col2 -->
        <div class="col2">
        	<?php echo CHtml::form(array('/qas/search'), 'get', array('id' => 'qas_search_form')); ?>
	        <div class="search">	
				<h3 class="cRed"><span class="icon"></span>问吧搜索</h3>
	            <p><input name="key" type="text" size="15" class="sIpt"/><br />
				<input type="submit" class="sBtn mt10" value="搜索" />
	            </p>
	        </div>
        	<?php echo CHtml::endForm(); ?>
	        <br />
			<?php $this->widget('QAsHistory') ?>
        	<?php $this->widget('RandomPsy'); ?>
        </div>
        <!-- End of Col2 -->
    </div><!-- End of area3s -->
</div>
